<?php
namespace app\member\controller;
use think\Controller;
use app\member\model\Member as MemberModel;
class Reg extends Common
{
    public function index()
    {   
    	if(request()->isPost()){
            $this->check(input('ckcode'));
        	$member=new MemberModel();
        	$data=array("username"=>input('realname'),"mobile"=>input('username'),"password"=>input('password'),"qq"=>'',"weixin"=>'',"fax"=>'',"vip"=>0,"fax"=>'',"remark"=>'');
        	$member->save($data);
        	$this->success('注册成功！',url('member/reg/index'));
        }
    	
        return view();
    }





    public function check($code='')
    {
        if (!captcha_check($code)) {
            $this->error('验证码错误');
        } else {
            return true;
        }
    }
}
